#include<AT89X52.h>
int a,b,k;
char ch5[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
void Key()
{
P2=0xf0;
if(P2==0xf0)
{
P1= 0xfe;
P0=0x0;
}
else
{
if(P2==0x70)
a=0;
if(P2==0xb0)
a=1;
if(P2==0xd0)
a=2;
if(P2==0xe0) 
a=3;
P2=0x0f;
if(P2==0x0e)
b=0;
if(P2==0x0d)
b=1;
if(P2==0x0b)
b=2;
if(P2==0x07)
b=3;
}
k=4*a+b;
P1=0xfe;
P0=ch5[k];
}

void Func4()
{
  while(1)
{
Key();
//Delay();
}

}
